package pl.edu.agh.student.vrp;

public class Destination {

    private int customerNo;
    private double xCoordinate;
    private double yCoorginate;
    private double demand;
    private double readyTime;
    private double dueTime;
    private double serviceTime;

    public Destination() {

    }

    public Destination(int customerNo, double xCoordinate, double yCoorginate, double demand, double readyTime, double dueTime, double serviceTime) {
        this.customerNo = customerNo;
        this.xCoordinate = xCoordinate;
        this.yCoorginate = yCoorginate;
        this.demand = demand;
        this.readyTime = readyTime;
        this.dueTime = dueTime;
        this.serviceTime = serviceTime;
    }

    public double distanceTo(Destination customer) {
        double dist = Math.pow(this.xCoordinate - customer.getxCoordinate(), 2);
        dist += Math.pow(this.yCoorginate - customer.getyCoorginate(), 2);
        return Math.sqrt(dist);
    }

    public String getId(Destination clientB) {
        return getId(customerNo - 1, clientB.customerNo - 1);
    }

    public static String getId(int clientA, int clientB) {
        return new String(Math.min(clientA, clientB)
                + "|" + Math.max(clientA, clientB));
    }


    public int getCustomerNo() {
        return customerNo;
    }

    public void setCustomerNo(int customerNo) {
        this.customerNo = customerNo;
    }

    public double getDemand() {
        return demand;
    }

    public void setDemand(double demand) {
        this.demand = demand;
    }

    public double getDueTime() {
        return dueTime;
    }

    public void setDueTime(double dueTime) {
        this.dueTime = dueTime;
    }

    public double getReadyTime() {
        return readyTime;
    }

    public void setReadyTime(double readyTime) {
        this.readyTime = readyTime;
    }

    public double getServiceTime() {
        return serviceTime;
    }

    public void setServiceTime(double serviceTime) {
        this.serviceTime = serviceTime;
    }

    public double getxCoordinate() {
        return xCoordinate;
    }

    public void setxCoordinate(double xCoordinate) {
        this.xCoordinate = xCoordinate;
    }

    public double getyCoorginate() {
        return yCoorginate;
    }

    public void setyCoorginate(double yCoorginate) {
        this.yCoorginate = yCoorginate;
    }

}
